Skip to content

PR updates stay true: description, risk, own review, generated types, e2e skips, content notes, questions, ticket comments - #353

Merged
nambok merged 1 commit into
mainfrom
fix/pr-updates-stay-true
Oct 29, 2026
Merged

nambok merged 1 commit into
mainfrom
fix/pr-updates-stay-true

Conversation

@nambok

@nambok nambok commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

A new-feature pull request that CoderHelm opened and then updated over several runs went wrong in eight ways: the description kept describing the first commit, the Risk was "Low" for a change to a query every page uses, CoderHelm's own review repeated the old claims, the generated types were never regenerated, the new end-to-end test skipped itself when staging content was missing, the content note told editors to add a block that staging already had in an older shape, one question was asked on every update, and the same ticket comment was posted twice. Each is fixed in the code that writes or checks that part, with a test.

Changes

1. Description rewritten from the final diff on every update

  • passes/resume.rs: a CI, security or review fix round that lands commits now calls pr::refresh_description. Before, only the feedback path did, so later commits left the first description in place.
  • passes/pr.rs (refresh_description): the rewrite is told to rebuild Changes from this diff and drop statements about an earlier version, to set Risk from the diff, and to keep in Verification only the commands whose results the description shows for the current commit.
  • passes/review_fix/evidence.rs: only the newest review fix round keeps its check results. Older rounds keep one headline line, so a "Full test suite FAILED" from an earlier commit no longer stays in the description.

2. Risk follows from the diff (new passes/pr_risk.rs)

  • floor reads the diff and sets the lowest level the description may state. These raise it: a file every page or request goes through (a shared query or fragment, a layout, middleware, global config, or a file the code graph shows 8 or more files importing), a network call added where pages render, and the reviewer's hard rules (migration, auth, payments). A shared file plus a new call per render is High.
  • enforce raises a lower stated level and puts the reasons, with the files, first in the Risk section. It never lowers a level. Both the first writer and the refresh use it. The writer's template now offers High, and the writer is told the floor.

3. CoderHelm's own review doesn't keep stale claims

  • passes/review_verdict.rs: when a finished review of a new commit posts nothing (same verdict, CoderHelm's own push), refresh_standing replaces the body of CoderHelm's standing review with the new review, under an "Updated for <sha>" line. The body is edited in place, so nobody gets a new notification. GitHubClient::update_pr_review is added to the review endpoints only this module may call.
  • passes/review_pr.rs: threads the new commit settled are resolved whether or not a review was posted. Before, they were resolved only when one was.

4. Generated types: why the gate missed it, and the new check
Reading generators::gate from #331 turned up four holes:

  • It ran only before the PR opened. Later review fix rounds and CI rounds never ran it.
  • A run that "passed" with no file changes counted as up to date even when the schema had a new type (a script that skipped schema extraction, for example).
  • When the generator couldn't run, an output file edited by hand counted as regenerated.
  • The fix round was told to update generated files by hand, and nothing checked for types declared by hand.

The fixes, in passes/generators.rs:

  • ownership_problems: for each type the change adds to a generator's inputs (Sanity defineType, GraphQL type/input/enum, Prisma model, protobuf message), the generated output must contain it, and no source file may declare a parallel type/interface for it (GalleryProps for the generated Gallery). A type built from the generated one, such as Gallery & {…}, is allowed. This runs in every gate pass and goes to the existing fix round.
  • Sanity typegen settings in sanity.cli.* (typegen.generates, typegen.path) are read, so the output path is right in newer setups.
  • The fix round is told to use run_codegen and import the generated type. Writing generated files by hand is only for when run_codegen isn't offered.
  • passes/review_fix/mod.rs: review fix rounds get the same check as a step (generated_step), run on the staged files. It reports a finding first, then holds the push.

5. End-to-end tests can't pass by skipping (passes/feature/checklist.rs, feature/mod.rs)

  • data_skips finds test.skip, fixme, it.skip, this.skip() and similar calls that a new or changed spec adds. Skips whose condition names a browser or platform (browserName, process.platform, isMobile, a project name) are allowed.
  • The new checklist item "end-to-end tests fail when their content is missing" fails on them. It goes into the fix round's feedback, which tells the coder to fail with a message naming the missing content.

6. Content notes check what is already there

  • passes/feature/content.rs: before the staging content note asks for a block, read-only queries look for blocks of that type, both inside the document fields that list it and as documents of their own. When one exists, the note says to replace or update that exact document and key, lists the fields to set and to remove, and gives the query that confirms the change. With no connection, the note says it couldn't look instead of guessing.
  • passes/fix_location.rs: the planner's outside change has a new existing field, for what it looked up about existing content and what came back. A change that adds content with that field empty gets a "Not checked" line in the PR and on the ticket, saying to check first and update an existing one rather than add a second.

7. Questions asked once; answered ones go

  • passes/resolved.rs (settled_on_ticket): the ticket's own text and people's comments on it now count as settled entries next to the answers. passes/plan.rs and feature::open_questions check the decision's and the product questions against them every run, not only when answers exist. A question the ticket settles (for example "this replaces the earlier work") leaves the plan, the ticket comment and the PR description.
  • passes/mod.rs (report_questions): each question is recorded on the ticket's record. A later run doesn't ask it again and never waits on it.

8. One ticket comment per thing (common/src/ticket_state.rs, passes/mod.rs)

  • notice_text/notice_hash compare notices with whitespace, emphasis, timestamps and run links taken out. notice_action decides between skip, edit and post.
  • post_ticket_notice posts "Also needed outside the code" and the questions through it. The same text is never posted again. New text edits the earlier GitHub comment (its id is now kept on the notice). Jira comments can't be edited here, so only changed text is posted there.

Already covered before this PR:

This PR adds to those: the question check against the ticket text, the generator gaps above, two new checklist items, the content lookup, and description refresh on fix rounds.

Verification

  • cargo fmt --all --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test --workspace: 2,826 passed, 0 failed, 16 ignored (common 1,277, gateway 605 + 2, worker 942).
  • New tests, one or more per fix:
    • pr_risk::tests (6)
    • review_fix::evidence::tests::an_older_rounds_results_go_when_a_newer_round_lands
    • generators::tests::a_new_schema_type_must_be_generated_and_imported, schema_languages_name_their_new_types, typegen_settings_in_the_sanity_cli_config_are_read
    • review_fix::tests::a_later_round_that_edits_a_schema_needs_the_generated_types
    • checklist::tests::a_spec_that_skips_on_missing_content_fails_the_checklist
    • content::tests::a_block_already_on_staging_is_replaced_not_added
    • fix_location::tests::a_note_that_adds_content_says_what_is_already_there_or_that_nobody_looked
    • review_verdict::tests::a_silent_review_of_a_new_commit_replaces_the_old_reviews_claims
    • resolved::tests::the_ticket_text_and_people_comments_settle_questions
    • ticket_notice_tests::a_question_is_asked_on_the_ticket_once
    • ticket_state::tests::the_same_note_from_two_runs_minutes_apart_is_posted_once

Not done here: the refresh after a fix round doesn't rerun the questions check against new ticket comments. That happens on the next ticket run.

… skips, content notes, questions and ticket comments

A new-feature PR that CoderHelm updated over several runs kept describing
its first state, called a change to a shared query Low risk, left its own
review saying the same, shipped without regenerated types, had an e2e test
that skipped when content was missing, told editors to add a CMS block
that staging already had, repeated one question on every update and
posted the same ticket comment twice.

- Fix rounds on an open PR rewrite its description from the whole diff;
  older review-fix rounds keep only their headline, so a failed suite of an
  earlier commit is not left in it.
- The Risk level follows from the diff (shared files, a network call per
  page render, the reviewer's hard rules) and is raised with its reasons
  when the writer states less.
- A silent review of a new commit replaces the body of CoderHelm's
  standing review, and threads the commit settled are resolved either way.
- The generators gate checks that new schema types are in the generated
  output and that no file declares a parallel copy; review fix rounds run
  the same check; Sanity typegen settings in sanity.cli are read.
- The feature checklist fails an e2e spec that skips on missing content.
- Content notes look up blocks already on staging and name the one to
  replace, or say they could not look.
- Questions are judged against the ticket text and comments, asked once
  per ticket, and ticket notices are posted once (edited in place on
  GitHub).
@nambok
nambok merged commit e783565 into main Oct 29, 2026
8 checks passed
@nambok
nambok deleted the fix/pr-updates-stay-true branch October 29, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant